package com.antler.smt.portal.service.impl;

import com.antler.smt.entity.GatheringInformationEntity;
import com.antler.smt.portal.mapper.GatheringInformationEntityMapper;
import com.antler.smt.request.portal.GatherReq;
import com.antler.smt.response.base.Result;
import com.antler.smt.service.portal.GatherService;
import com.antler.smt.utils.DateUtil;
import com.antler.smt.utils.ReturnResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.ResponseStatus;

import java.time.DayOfWeek;

/**
 * 收款信息服务实现类
 *
 * @author zhangyi
 * @date 2018/9/25 14:06
 */
@Service
public class GatherServiceImpl implements GatherService {

    @Autowired
    private GatheringInformationEntityMapper gatheringInformationEntityMapper;

    /**
     *  写入收款信息
     *
     * @param gatherReq
     * @return
     */
    @Override
    public Result insertGather(GatherReq gatherReq) {
        //创建收款信息实体
        GatheringInformationEntity gather = new GatheringInformationEntity();
        gather.setPeopleInfoId(gatherReq.getPeopleInfoId());
        gather.setBranchName(gatherReq.getBranchName());
        gather.setBranch(gatherReq.getBranch());
        gather.setBankCard(gatherReq.getBankCard());
        gather.setAlipay(gatherReq.getAlipay());
        gather.setBankName(gatherReq.getBankName());
        gather.setCreateTime(DateUtil.stampToDate(System.currentTimeMillis()));
        int i = gatheringInformationEntityMapper.insertSelective(gather);
        return ReturnResultUtil.getResult("插入成功","插入失败",i);
    }
}
